import os

from celery.schedules import crontab

celery_imports = (  # 指定导入的任务模块
    'celery_app.tasks',
)

REDIS_HOST = '127.0.0.1'
REDIS_PORT = '6379'
REDIS_DB = '6'
REDIS_PASSWORD = 'root'
RESULT_DB = '9'

# 任务队列
# broker_url BROKER_URL
broker_url = f'redis://:{REDIS_PASSWORD}@{REDIS_HOST}:{REDIS_PORT}/{REDIS_DB}'
# celery_result_backend CELERY_RESULT_BACKEND
result_backend = f'redis://:{REDIS_PASSWORD}@{REDIS_HOST}:{REDIS_PORT}/{RESULT_DB}'
# celery_timezone
timezone = 'Asia/Shanghai'  # 指定时区，默认是 UTC
# CELERY_TIMEZONE='UTC'

# 定时任务节拍器
beat_schedule = {
    # "bond_yield_curve_ref_info": {
    #     "task": "celery_app.tasks.bond_yield_curve_ref_info",
    #     "schedule": crontab(hour=13, minute=10),  # 每天执行
    # },
    "test": {
        "task": "celery_app.tasks.test",
        "args": [3, 9],
        "schedule": crontab(hour=13, minute=15),  # 每天执行
    },

}
